import ContourAnalysis from './ContourAnalysis'
export default class Contour{
    _viewer:any
    _countourEntity:Array<any>
    contourClass:any
    constructor(viewer){
        this._viewer=viewer
        this._countourEntity=[]
    }
    get countourEntity(){
        return this._countourEntity
    }
    create(errorCallback,options){
        let viewer=this._viewer
        if (!viewer.terrainProvider._layers) {
            if (errorCallback && typeof errorCallback == "function")
              errorCallback("请先开启地形");
            return;
          }
          const callback = (e) => {
            this._countourEntity.push(e);
          };
          this.contourClass = new ContourAnalysis(viewer, callback);
          this.contourClass.createContour({
            ...options,
            countorLineList: [],
          });
    }
    removeAll(){
        let viewer=this._viewer
        this._countourEntity.forEach((item) => {
        item.forEach((element) => {
          viewer.dataSources.remove(element);
        });
      });
    }
}